package main

import (
	"context"
	"fmt"
	"github.com/liuxinbo1984/iprotoc/hello"
	"google.golang.org/grpc"
)

func main() {
	conn, err := grpc.Dial("127.0.0.1:8080", grpc.WithInsecure())
	if err != nil {
		panic(err)
	}
	defer func(conn *grpc.ClientConn) {
		err := conn.Close()
		if err != nil {
			fmt.Println("connection fail!")
		}
	}(conn)

	//业务模块+服务service客户端
	c := hello.NewGreeterClient(conn)
	r, err := c.SayHello(context.Background(), &hello.HelloRequest{Name: "bobby"})
	if err != nil {
		panic(err)
	}
	fmt.Println(r.Message)
}
